using System;
using System.Collections.Generic;
using Comdiv.Extensions;
using Comdiv.Model;
using Comdiv.Model.Interfaces;
using Comdiv.Logging;
using Comdiv.Application;
using Comdiv.Persistence;
using Comdiv.Inversion;
using Comdiv.Security.Acl;
using Comdiv.Conversations;
using Comdiv.IO;
using Comdiv.Security;
using System.Linq;

namespace Comdiv.Dbfs{
    public class FileHistory: IFileHistory{
        public virtual int Id { get; set; }
        public virtual string Name { get; set; }
        public virtual string Code { get; set; }
        public virtual string Comment { get; set; }
        public virtual DateTime Version { get; protected set; }
        public virtual int Revision { get; protected set; }
        public virtual string System { get; set; }
        public virtual string Mime { get; set; }
        public virtual string Extension { get; set; }
        public virtual string Hash { get; protected set; }
        public virtual long Size { get; protected set; }

        private IFileContent _data;

        public virtual IFileContent Data
        {
            get { return _data; }
            set { _data = value; }
        }

        public virtual byte[] NewData { get; set; }
        public virtual IList<IFileHistory> History
        {
            get;
            set;
        }

        public virtual bool IsDataLoaded
        {
            get { return null != _data; }

        }

        public virtual IFile Target { get; set; }
        public virtual string Owner { get; set; }
        public virtual string Editor { get; set; }
        public virtual DateTime CreateTime { get; protected set; }
        public virtual DateTime ChangeTime { get; protected set; }
        public virtual string ReadList { get; set; }
        public virtual string ChangeList { get; set; }
        public virtual string AccessList
        {
            get { return ReadList + "," + ChangeList; }

        }

        public virtual string Tag { get; set; }
        public virtual bool Deleted { get; set; }
        public virtual bool Archived { get; set; }
        public virtual bool ReadOnly { get; set; }
        public virtual string Usr { get; set; }
        public virtual IFile Source
        {
            get; set;
        }
    }
}